<!DOCTYPE html>
<!--[if IE 9]>         <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">

        <title>智数法财,国家统计局数据分析 | Login </title>

        <meta name="description" content="ProUI is a Responsive Bootstrap Admin Template created by pixelcave and published on Themeforest.">
        <meta name="author" content="pixelcave">
        <meta name="robots" content="noindex, nofollow">
        <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0">

        <!-- Icons -->
        <!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
        <link rel="shortcut icon" href="img/favicon.png">
        <link rel="apple-touch-icon" href="img/icon57.png" sizes="57x57">
        <link rel="apple-touch-icon" href="img/icon72.png" sizes="72x72">
        <link rel="apple-touch-icon" href="img/icon76.png" sizes="76x76">
        <link rel="apple-touch-icon" href="img/icon114.png" sizes="114x114">
        <link rel="apple-touch-icon" href="img/icon120.png" sizes="120x120">
        <link rel="apple-touch-icon" href="img/icon144.png" sizes="144x144">
        <link rel="apple-touch-icon" href="img/icon152.png" sizes="152x152">
        <link rel="apple-touch-icon" href="img/icon180.png" sizes="180x180">
        <!-- END Icons -->

        <!-- Stylesheets -->
        <!-- Bootstrap is included in its original form, unaltered -->
        <link rel="stylesheet" href="/res1/css/bootstrap.min.css">

        <!-- Related styles of various icon packs and plugins -->
        <link rel="stylesheet" href="/res1/css/plugins.css">

        <!-- The main stylesheet of this template. All Bootstrap overwrites are defined in here -->
        <link rel="stylesheet" href="/res1/css/main.css">

        <!-- Include a specific file here from /res1/css/themes/ folder to alter the default theme of the template -->

        <!-- The themes stylesheet of this template (for using specific theme color in individual elements - must included last) -->
        <link rel="stylesheet" href="/res1/css/themes.css">
        <!-- END Stylesheets -->

        <!-- Modernizr (browser feature detection library) -->
        <script src="js/vendor/modernizr.min.js"></script>
    </head>
    <body>
        <!-- Login Background -->
        <div id="login-background">
            <!-- For best results use an image with a resolution of 2560x400 pixels (prefer a blurred image for smaller file size) -->
            <img src="img/placeholders/headers/login_header.jpg" alt="Login Background" class="animation-pulseSlow">
        </div>
        <!-- END Login Background -->

        <!-- Login Container -->
        <div id="login-container" class="animation-fadeIn">
            <!-- Login Title -->
            <div class="login-title text-center">
               <img src="/res1/img/logo-tjj.png" width="300px" height="180px" alt="">
            </div>
            <!-- END Login Title -->

            <!-- Login Block -->
            <div class="block push-bit">
                <!-- Login Form -->
                <form action="index.html" method="post" id="form-login" class="form-horizontal form-bordered form-control-borderless">
                    <div class="form-group">
                        <div class="col-xs-12">
                            <div class="input-group">
                                
                                <input type="text" id="username" name="login-email" class="form-control input-lg" placeholder="User Name">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-xs-12">
                            <div class="input-group">
                              
                                <input type="password" id="password" name="login-password" class="form-control input-lg" placeholder="Password">
                            </div>
                        </div>
                    </div>
                    <div class="form-group form-actions">
                       
                        <div class="col-xs-8 text-right">
                            <button id="btn_login" type="button" class="btn btn-sm btn-primary"><i class="fa fa-angle-right"></i> Login to Dashboard</button>
                        </div>
                    </div>
                   
                </form>
               
                <!-- END Reminder Form -->

               
                <!-- END Register Form -->
            </div>
            <!-- END Login Block -->

            <!-- Footer -->
            <footer class="text-muted text-center">
                <small><span id="year-copy"></span> &copy; <a>think-data.cn</a></small>
            </footer>
            <!-- END Footer -->
        </div>
        <!-- END Login Container -->

        <!-- Modal Terms -->
        
        <!-- END Modal Terms -->

        <!-- jQuery, Bootstrap.js, jQuery plugins and Custom JS code -->
        <script src="/res1/js/vendor/jquery.min.js"></script>
        <script src="/res1/js/vendor/bootstrap.min.js"></script>
        <script src="/res1/js/plugins.js"></script>
        <script src="/res1/js/app.js"></script>
<script src="/res1/js/layer/layer.js" type="text/javascript"></script>
        <!-- Load and execute javascript code used only in this page -->
        <script src="/res1/js/pages/login.js"></script>
      <script>
    //c 计数，第一次尝试用session和cookie登录，不成功才需要输入用户名密码
    var c = 0;

    //login();

    $("#btn_login").click(function (data) {
        login();
    });

    $("#register-submit-btn").click(function () {
        signup();
    });

    function login() {
    	var uname = $("#username").val();
    	var pwd = $("#password").val();
    	if(uname==''||uname==null||uname==undefined){
    		layer.msg("Please input your user name");
    		return;
    	}
    	
    	if(pwd==''||pwd==null||pwd==undefined){
    		layer.msg("Please input your password");
    		return;
    	}
    	
        $.post('/service/user/loginto',{
                username: uname,
                password: pwd
            },function (data) {
                if (data.code=='suc') {
                    window.location.href = "/";
                } else {
					layer.msg(data.msg);
                }
            });
    }

    function signup() {
        $.post('/service/user/signUp',
            {
                username: $("#s_username").val(),
                password: $("#s_pwd").val(),
                email: $("#s_email").val()
            },
            function (data, textStatus, xhr) {
                if (data.code == "suc") {
                    window.location.href = "/";
                } else {
                    layer.msg(data.msg);
                }
            });
    }

    $(document).keyup(function (e) {
        var code = e.charCode || e.keyCode;  //取出按键信息中的按键代码(大部分浏览器通过keyCode属性获取按键代码，但少部分浏览器使用的却是charCode)  
        if (code == 13) {
            login();
        }

    });
</script>
    </body>
</html>